<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>计划详情</title>
    <link rel="stylesheet" href="../../lib/layui/layui/css/layui.css">
    <link rel="stylesheet" href="../../lib/layui/css/layui.css">
    <script type="text/javascript" src="../../js/news/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="../../lib/layui/layui/lay/dest/layui.all.js"></script>
    <script src="../../js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../lib/layui/layui/layui.js"></script>
    <script type="text/javascript" src="/lib/highcharts.js"></script>
    <style>
        * {font-family: "Microsoft Yahei" !important;overflow-y: hidden;}
        nav button{
            margin-left: 5px;
            padding: .25rem .5rem;
            font-size: .875rem;
            border-radius: .2rem;
            float: right !important;
            margin-top: 10px
        }
        nav div{
            float: left !important;
            margin: 15px;
        }
        nav{
            height: 50px;
            border-bottom: 1px solid #cfdbe2;
            background-color: #fafbfc;
            border-radius: 0;
        }
        .layui-tab-title{
            border-bottom: 1px solid #cfdbe2;
            background-color: #fafbfc;
        }
        .layui-tab{
             margin:0;
        }
        .content{
            height: 509px;
            overflow: auto;
            margin: 14px;
            padding: 14px;
            background: #fff;
        }
        .layui-tab-content{
            background-color: #F5F7FA;
        }
        .search{
            display: inline;
            margin-bottom: 1px;
            padding-top: 6px;
            padding-bottom: 6px;
            width: 185px;
            border: 0;
        }
        .layui-form-label{
            width: 150px;
        }
        .spanText{
            margin-top: 25px;
            display: inline-block;
            margin-right:5px;
            background: #e8e8e8;
            color: #333;
            border-radius: 30px;
            line-height: 27px;
            padding-left: 20px;
            padding-right: 20px;
            position: relative;
            max-width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .layui-form-select dl {
            z-index: 9999;
        }
        .flow li a{
            color: blue;
        }
        .localAet li a{
            color: blue;
        }
        .relative{
            background-color: rgba(0,0,0,0.05);
            line-height: 27px;
            padding: 5px 0;
            margin-top: 15px;
            width: 70%;
        }
        p{
            line-height:38px
        }
    </style>
</head>
<body>
    <form class="layui-form" id="ajaxforms" action="/contract/insertContract">
    <nav>
        <div>计划详情</div>
        <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="history.go(-1)" style="margin-right: 30px">返回
        </button>
    </nav>

    <div>
        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
            <div class="layui-tab-content">
                <div class="content">
                        <form class="layui-form" action="">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">计划编号</label>
                                    <div class="layui-input-inline">
                                        <p readonly type="text" name="planCode" ></p>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">计划名称</label>
                                    <div class="layui-input-inline">
                                        <p readonly type="text" name="planName"></p>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">计划类别</label>
                                    <div class="layui-input-inline layui-form" lay-filter="mySelect">
                                        <p readonly type="text" name="planTypeName"></p>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">计划状态</label>
                                    <div class="layui-input-inline;border-bottom: 1px solid #ccc">
                                        <p readonly type="text" name="planStatus" ></p>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">计划周期</label>
                                    <div class="layui-input-inline">
                                        <p readonly type="text" name="planCycleUnit" ></p>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">实际执行周期</label>
                                    <div class="layui-input-inline">
                                        <p readonly type="text" name="actualCycle"></p>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">支出预算</label>
                                    <div class="layui-input-inline">
                                        <p readonly type="text" name="expenseBudget"></p>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">收入预估</label>
                                    <div class="layui-input-inline">
                                        <p readonly type="text" name="incomeBudget"></p>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">总支出</label>
                                    <div class="layui-input-inline">
                                        <p readonly type="text" name="realExpense"></p>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">总收入</label>
                                    <div class="layui-input-inline">
                                        <p readonly type="text" name="realIncome"></p>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">收支差</label>
                                    <div class="layui-input-inline">
                                        <p readonly type="text" name="realSubtract"></p>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">支出超预算开启</label>
                                    <div class="layui-input-inline">
                                        <p readonly type="text" name="isStart"></p>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">启动时间</label>
                                    <div class="layui-input-inline">
                                        <p readonly type="text" name="beginTime"></p>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">结束时间</label>
                                    <div class="layui-input-inline">
                                        <p readonly type="text" name="endTime"></p>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">创建人</label>
                                    <div class="layui-input-inline">
                                        <p readonly type="text" name="creatorName"></p>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">创建时间</label>
                                    <div class="layui-input-inline">
                                        <p readonly type="text" name="planCreateTime"></p>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">相关附件</label>
                                <div class="layui-input-block">
                                    <div id="Attachment" style="padding-bottom: 10px"></div>
                                    <input type="hidden" name="attachmentId" autocomplete="off" class="layui-input">
                                    <input type="hidden" name="attachmentName" autocomplete="off"
                                           class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">方案描述</label>
                                <div class="layui-input-block">
                                    <p readonly type="text" name="planDesc"></p>
                                </div>
                            </div>
                        </form>
                    </div>
            </div>
        </div>
    </div>
</form>
</body>
<script>
    $('.layui-input-inline').width($(document.body).width()/3-50);
    $('.layui-input-inline select').width($(document.body).width()/3);
    $('.content').height($(document.body).height());
    function GetQueryString(name) {
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);

        if(r!=null) {
            return  unescape(r[2]);
        } else {
            return null;
        }
    }
    layui.use(['form', 'layedit', 'laydate','table','upload'], function(){
        var form= layui.form
            ,layer = layui.layer
            ,laydate = layui.laydate
            ,layedit = layui.layedit
            ,table = layui.table
            ,upload = layui.upload;
        $(function () {
            $.ajax({
                url: '/IncomePlan/findIncomePlanById',
                type: 'get',
                dataType: 'json',
                data: {
                    planId:GetQueryString('planId')
                },
                success: function (data) {
                    var data=data.object
                    var str = ''
                    if(data.map.AttachmentList !='' && data.map.AttachmentList != undefined){
                        for(var i=0;i<data.map.AttachmentList.length;i++){
                            if (data.map.AttachmentList[i] != '' && data.map.AttachmentList[i] != undefined) {
                                str += '<div class="dech" deUrl="' + data.map.AttachmentList[i].attUrl + '"><a href="/download?' + data.map.AttachmentList[i].attUrl + '" NAME="' + data.map.AttachmentList[i].attachName + '*"><img style="width:16px;" src="/img/file/cabinet@.png"/>' + data.map.AttachmentList[i].attachName + '</a><input type="hidden" class="inHidden" value="' + data.map.AttachmentList[i].aid + '@' + data.map.AttachmentList[i].ym + '_' + data.map.AttachmentList[i].attachId + ',"></div>';
                            } else {
                                str = '';
                            }
                        }
                    }
                    $('#Attachment').html(str)
                    $('[name="planCode"]').text(data.planCode)
                    $('[name="planName"]').text(data.planName)
                    $('[name="planTypeName"]').text(data.planTypeName)
                    $('[name="planStatus"]').text(data.planStatus)
                    $('[name="planCycle"]').text(data.planCycle)
                    $('[name="expenseBudget"]').text(data.expenseBudget)
                    $('[name="incomeBudget"]').text(data.incomeBudget)
                    $('[name="realExpense"]').text(data.realExpense)
                    $('[name="isStart"]').text(data.isStart)
                    $('[name="plansesc"]').text(data.plansesc)
                    $('[name="creator"]').text(data.creator)
                    $('[name="endTime"]').text(data.endTime)
                    $('[name="creatorName"]').text(data.creatorName)
                    $('[name="beginTime"]').text(data.beginTime)
                    $('[name="planCreateTime"]').text(data.planCreateTime)
                    $('[name="realIncome"]').text(data.realIncome)
                    $('[name="planDesc"]').text(data.planDesc)
                    $('[name="realSubtract"]').text(data.map.realSubtract)
                    $('[name="actualCycle"]').text(data.planCycleUnit+data.planCycle)
                }
            });
        })
    });
</script>

</html>
